//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    goodList: [
      { typename:'推荐',
        typebg:'../../asset/image/icon/fruit.png',
        data:[
          { id: '1',img: '../../asset/image/groom1.jpg', goodname: '入夏套装新品', goodprice: '30.00', sellnum: '2500' },
          { id: '2',img: '../../asset/image/groom2.jpg', goodname: '新品上市', goodprice: '30.00', sellnum: '2500' },
          { id: '3',img: '../../asset/image/groom3.jpg', goodname: '时尚穿搭', goodprice: '30.00', sellnum: '2500' }]
      },
      {
        typename: '水果',
        typebg:'../../asset/image/icon/groom.png',
        data: [
          { id: '4',img: '../../asset/image/groom1.jpg', goodname: '进口火龙果', goodprice: '30.00', sellnum: '2500' },
          { id: '5',img: '../../asset/image/groom2.jpg', goodname: '海南芒果', goodprice: '30.00', sellnum: '2500' },
          { id: '6',img: '../../asset/image/groom3.jpg', goodname: '猕猴桃', goodprice: '30.00', sellnum: '2500' }]
      },
      {
        typename: '服装',
        typebg:'../../asset/image/icon/clothes.png',
        data: [
          { id: '7',img: '../../asset/image/groom1.jpg', goodname: '入夏套装新品', goodprice: '30.00', sellnum: '2500' },
          { id: '8',img: '../../asset/image/groom2.jpg', goodname: '新品上市', goodprice: '30.00', sellnum: '2500' },
          { id: '9',img: '../../asset/image/groom3.jpg', goodname: '时尚穿搭', goodprice: '30.00', sellnum: '2500' }]
      }
    ],
    banner:[
      { name: '水果', url: '', img: '../../asset/image/shopactive1.png' },
      { name: '服装', url: '', img: '../../asset/image/shopactive2.png' },
      { name: '美妆', url: '', img:'../../asset/image/shopactive3.png'},
    ]
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onReady:function(){
  },
  onLoad: function () {
    wx.getSetting({
      success(res) {
        if (!res.authSetting['scope.record']) {
          wx.authorize({
            scope: 'scope.record',
            success() {
              // 用户已经同意小程序使用录音功能，后续调用 wx.startRecord 接口不会弹窗询问
              wx.startRecord()
            }
          })
        }
      }
    })
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  },
  goodFruit:function(e){
    var val = e.currentTarget.id;
    wx.navigateTo({
      url: '/pages/shop/detials/detials?gid='+val
    })
  }
})
